/**
*      author: Y_Yao
*      created: 2024-11-28 18:32:17
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int mod = 1e6 + 7;
const int N = 100 + 7;
int a[N],dp[N][N];
int n,m;

void solve()
{
    cin >> n >> m;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
    }

    for(int i = 0;i <= n;i++) dp[i][0] = 1;
    //for(int i = 1;i <= m;i++) dp[0][i] = 1;
    for(int i = 1;i <= n;i++)
    {
        for(int j = 1;j <= m;j++)
        {
            for(int k = 0;k <= a[i];k++)
            {
                if(j - k >= 0) dp[i][j] += dp[i-1][j - k];
                dp[i][j] %= mod;
            }
        }
    }

    cout << dp[n][m] << endl;
}
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}